package com.smarth.zhizulian.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.smarth.zhizulian.R;
import com.smarth.zhizulian.bean.Category;
import com.smarth.zhizulian.utils.ViewHolder;

import java.util.List;

/**
 * Created by 18865 on 2017/12/22.
 */

public class CategoryAdapter extends BaseObjectListAdapter {
    private Category mWhich;

    public CategoryAdapter(Context context, List datas, Category which) {
        super(context, datas);
        this.mWhich = which;
    }

    @Override
    public View getItemView(int position, View convertView, ViewGroup parent) {
        convertView = getConvertView(convertView, R.layout.item_category);
        TextView tv_category = ViewHolder.get(convertView, R.id.tv_category);
        Category c = (Category) mDatas.get(position);
        tv_category.setText(c.getName());
        tv_category.setSelected(mWhich.getId() == c.getId());
        return convertView;
    }
}
